/**
 * 柯里化应用场景，提高代码复用性
 * @param {protocol, hostname, patchname}
*/

const curry = (fn, ...args) => {
  return args.length >= fn.length ? fn(...args) : (..._args) => curry(fn, ...args, ..._args)
}

function spliceURL(protocol, hostname, patchname) {
  return `${protocol}${hostname}${patchname}`
}

const url1 = spliceURL('https://', 'juejin.cn', 'post/asdfskajdhfjas/')
console.log(url1)

const currySpliceUrl = curry(spliceURL, 'juejin.cn', 'post/asdfskajdhfjas/')

